#ifndef __mst_sys_linux_h__
#define __mst_sys_linux_h__
//----------------------------------------------------------------------------
//
// (C) Copyrights MARIN/MSCN  2004 
//
//----------------------------------------------------------------------------
//
// $Source: /cvsdb/include/CC/radar/util/sys/sgi.h,v $
//
// $State: Exp $
//
// $Locker:  $
//
// $Revision: 1.2 $
//
// $Date: 2003/03/25 12:52:23 $
//
// $Author: mscn $
//
// $Contractor: $
//
// $Project: $
//
// $Log: sgi.h,v $
//
// $Description: $
//
// $End: $
//
//----------------------------------------------------------------------------

#ifdef linux
#include <ieee754.h>
#include <sys/types.h>

#define MST_SQRTF(x) ::sqrtf(x)
#define MST_SINF(x) ::sinf(x)
#define MST_COSF(x) ::cosf(x)
#define MST_TANF(x) ::tanf(x)
#define MST_LOGF(x) ::logf(x)
#define MST_LOG10F(x) ::log10f(x)
#define MST_CEILF(x) ::ceilf(x)
#define MST_FLOORF(x) ::floorf(x)
#define MST_ROUNDF(x) ::roundf(x)
#define MST_TRUNCF(x) ::truncf(x)
#define MST_ATAN2F(y,x) ::atan2f(y,x)
#define MST_FMODF(x,y) ::fmodf(x,y)
#define MST_ASINF(x) ::asinf(x)
#define MST_ACOSF(x) ::acosf(x)
#define MST_ATANF(x) ::atanf(x)
#define MST_POWF(x,y) ::powf(x,y)
#define MST_SINHF(x) ::sinhf(x)
#define MST_COSHF(x) ::coshf(x)
#define MST_TANHF(x) ::tanhf(x)
#define MST_ASINHF(x) ::asinhf(x)
#define MST_ACOSHF(x) ::acoshf(x)
#define MST_ATANHF(x) ::atanhf(x)
#define MST_ISNANF(x) (isnan(x) != 0)
#define MST_ISNAND(x) (isnan(x) != 0)
#define MST_EXPF(x) (::expf(x))
#define MST_SRAND48(v) ::srand48(v)

#ifndef fpclassify
/* Return number of classification appropriate for X.  */
# ifdef __NO_LONG_DOUBLE_MATH
#  define mst_fpclassify(x) \
     (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x))
# else
#  define mst_fpclassify(x) \
     (sizeof (x) == sizeof (float)                                            \
      ? __fpclassifyf (x)                                                     \
      : sizeof (x) == sizeof (double)                                         \
      ? __fpclassify (x) : __fpclassifyl (x))
# endif
#else
#define mst_fpclassify fpclassify
# endif

#ifndef signbit
# ifdef __NO_LONG_DOUBLE_MATH
#  define mst_signbit(x) \
     (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x))
# else
#  define mst_signbit(x) \
     (sizeof (x) == sizeof (float)                                            \
      ? __signbitf (x)                                                        \
      : sizeof (x) == sizeof (double)                                         \
      ? __signbit (x) : __signbitl (x))
#endif
#else
#define mst_signbit signbit
# endif

#define MST_FPCLASS(a) \
switch(mst_fpclassify(a)) {\
	case FP_NAN: return mst::eNan;\
	case FP_INFINITE: return (mst_signbit(a) == 0) ? mst::ePInfinite : mst::eNInfinite;\
	case FP_ZERO: return (mst_signbit(a) == 0) ? mst::ePZero : mst::eNZero;\
	case FP_SUBNORMAL: return (mst_signbit(a) == 0) ? mst::ePSubnormal : mst::eNSubnormal;\
	case FP_NORMAL: return (mst_signbit(a) == 0) ? mst::ePNormal : mst::eNNormal; \
	default: return mst::ePNormal;\
}

#define mst_uint32_t ::__uint32_t
#define mst_int32_t ::__int32_t
#define mst_uint64_t ::__uint64_t
#define mst_int64_t ::__int64_t

#endif


#endif

